using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

namespace UnityEditor.Rendering.Universal
{


    [CustomEditor(typeof(NVRenderData),true)]
    public class NVRendeDataEditor : Editor 
    {
        SerializedProperty m_Shaders;

        private void OnEnable()
        {
            m_Shaders = serializedObject.FindProperty("shaders");
        }

        /// <inheritdoc/>
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            // Add a "Reload All" button in inspector when we are in developer's mode
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(m_Shaders, true);

            if (GUILayout.Button("Reload All"))
            {
                var resources = target as NVRenderData;
                resources.shaders = null;
                ResourceReloader.ReloadAllNullIn(target, NVRenderData.NVLibaryPath);
            }
            

            serializedObject.ApplyModifiedProperties();
        }
    }
}

